<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class GoodsEvaluate
 * @package App\Models
 * @version October 30, 2017, 6:09 am CST
 *
 * @property integer order_id
 * @property integer goods_id
 * @property integer attribute_id
 * @property integer level
 * @property string content
 * @property integer user_id
 * @property string reply
 * @property string pictures
 * @property integer is_anonym
 */
class GoodsEvaluate extends Model
{
    use SoftDeletes;

    public $table = 'goods_evaluates';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'shop_id',
        'order_id',
        'goods_id',
        'attribute_id',
        'level',
        'content',
        'user_id',
        'reply',
        'pictures',
        'is_anonym'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'order_id' => 'integer',
        'goods_id' => 'integer',
        'attribute_id' => 'integer',
        'level' => 'integer',
        'content' => 'string',
        'user_id' => 'integer',
        'reply' => 'string',
        'pictures' => 'string',
        'is_anonym' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];


    public function order()
    {
        return $this->belongsTo('App\Models\Order');
    }

    public function attribute()
    {
        return $this->belongsTo('App\Models\GoodsAttribute');
    }

    public function goods()
    {
        return $this->belongsTo('App\Models\Goods');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    
}
